/*
 * @Author: luqinghua
 * @Date: 2023-08-27 21:28:37
 * @LastEditors: luqinghua
 * @LastEditTime: 2024-09-12 13:45:35
 * @FilePath: \gic-webd:\DownLoad\7 my project\vite-vue3-template\vite.config.ts
 * @Description:
 */
import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import tailwindcss from 'tailwindcss'
import autoprefixer from 'autoprefixer'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  base: '/vite/',
  plugins: [vue(), vueJsx()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true,
        additionalData: `@import "${path.resolve(__dirname, 'src/theme/style.less')}";`
      }
    },
    postcss: {
      plugins: [
        tailwindcss,
        autoprefixer({
          overrideBrowserslist: ['last 2 versions']
        })
      ]
    }
  }
})
